@echo off
set source_dir=D:\Code\thirdparty\rt-thread
set driv_dir=bsp\nuvoton\libraries\nuc980
set package_dir=bsp\nuvoton\libraries\nu_packages
git -C %source_dir% reset HEAD --hard
git -C %source_dir% clean -xdf
git -C %source_dir% checkout v5.1.0

del /f /s /q lib-nuc980
rmdir /s /q lib-nuc980
del /f /s /q nu_packages
rmdir /s /q nu_packages
del /f /s /q rt-thread
rmdir /s /q rt-thread

mkdir lib-nuc980
mkdir nu_packages
mkdir rt-thread
mkdir rt-thread\components
mkdir rt-thread\include
mkdir rt-thread\libcpu
mkdir rt-thread\src

xcopy /e /k /h /i %source_dir%\%driv_dir% lib-nuc980
xcopy /e /k /h /i %source_dir%\%package_dir% nu_packages
xcopy /e /k /h /i %source_dir%\components rt-thread\components
xcopy /e /k /h /i %source_dir%\include rt-thread\include
xcopy /e /k /h /i %source_dir%\libcpu rt-thread\libcpu
xcopy /e /k /h /i %source_dir%\src rt-thread\src
